import * as React from "react";
import Link from "next/link";
import { getChapterProps, getLessons } from "../../src/lib/file";
import type { Context } from "../../src/utils/chapterPageMethods";
import { getStartFileProps } from "../../src/lib/markdown";
type CompletedProps = {
firstChapterId: string | undefined;
lessonId: string;
title: string;
description: string;
body: any;
};
export default function Start({
firstChapterId,
lessonId,
title,
description,
body,
}: CompletedProps) {
return (
);
}
export async function getStaticProps(context: Context) {
const {
params: { lessonId },
} = context;
const { firstChapter } = getChapterProps(lessonId);
const { title, description, body } = getStartFileProps(lessonId);
return {
props: {
firstChapterId: firstChapter?.id,
lessonId,
title,
description,
body,
},
};
}
export const getStaticPaths = () => {
const lessons = getLessons();
let paths: string[] = [];
lessons.map((lesson: { id: number }) => {
paths.push(`/lesson/${lesson.id}`);
});
return {
paths: paths,
fallback: false,
};
};